package nextfm.dao;

import java.util.List;

import javax.persistence.Query;

import nextfm.model.Album;

public class DAOAlbum extends DAOJPA<Album> {

	public DAOAlbum() {
		super();
	}
	
	@SuppressWarnings("unchecked")
	public List<Album> findLastAdded() {
		String sql = "SELECT a FROM Album a ORDER BY a.id DESC";
		Query query = getManager().createQuery(sql);
		
		return query.setMaxResults(3).getResultList();
		
	}
}
